home *** CD-ROM | disk | FTP | other *** search
/ Ultra Gameplayers 101 / Ultra Game Players Magazine, No. 101 - September 1997 (Imagine Publishing, Inc.)(1997).iso / pc / new_ugp.dxr / 00344_unused String Utilities.ls < prev    next >
Encoding:
Text File  |  1997-07-10  |  1.5 KB  |  52 lines

  1. on TitleCase mytext
  2.   repeat with index = 1 to the number of words in mytext
  3.     set myword to word index of mytext
  4.     set mychar to char 1 of myword
  5.     set mycharval to charToNum(mychar)
  6.     if (mycharval > 96) and (mycharval < (96 + 27)) then
  7.       set mychar to numToChar(mycharval - 32)
  8.       put mychar into char 1 of myword
  9.       put myword into word index of mytext
  10.     end if
  11.   end repeat
  12.   return mytext
  13. end
  14.  
  15. on UnTitleCase mytext
  16.   repeat with index = 1 to the number of words in mytext
  17.     set myword to word index of mytext
  18.     set mychar to char 1 of myword
  19.     set mycharval to charToNum(mychar)
  20.     if (mycharval > 64) and (mycharval < (64 + 27)) then
  21.       set mychar to numToChar(mycharval + 32)
  22.       put mychar into char 1 of myword
  23.       put myword into word index of mytext
  24.     end if
  25.   end repeat
  26.   return mytext
  27. end
  28.  
  29. on UpperCase mytext
  30.   repeat with index = 1 to the number of chars in mytext
  31.     set mychar to char index of mytext
  32.     set mycharval to charToNum(mychar)
  33.     if (mycharval > 96) and (mycharval < (96 + 27)) then
  34.       set mychar to numToChar(mycharval - 32)
  35.       put mychar into char index of mytext
  36.     end if
  37.   end repeat
  38.   return mytext
  39. end
  40.  
  41. on LowerCase mytext
  42.   repeat with index = 1 to the number of chars in mytext
  43.     set mychar to char index of mytext
  44.     set mycharval to charToNum(mychar)
  45.     if (mycharval > 64) and (mycharval < (64 + 27)) then
  46.       set mychar to numToChar(mycharval + 32)
  47.       put mychar into char index of mytext
  48.     end if
  49.   end repeat
  50.   return mytext
  51. end
  52.